<!--瀹夋帓宸ュ粻-->
            <div class="modal fade" id="factory" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
				<div class="modal-dialog">
					<div class="modal-content">
						<div class="modal-header">
							<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
								&times;
							</button>
							<h4 class="modal-title" id="myModalLabel">
								选择工厂
							</h4>
						</div>
						<div class="modal-body">
						<form class="form-horizontal" role="form" id="factoryform">
						
							<div class="tk_content tk_head">
			            			    <select name="factoryId" class="selectpicker show-tick form-control"  data-live-search="true">  
                        <option selected="selected" value="">请选择</option> 
                        <#list factoryList as factory>
                        <option value="${factory.id}">${factory.name!}</option>  
                        </#list>
                         
                    </select> 
			            	</div>
			            	</form>
						</div>
						<div class="modal-footer">
							<button type="button" onclick="saveAssignFactory()" class="btn btn-primary">确定
							</button>
							<button type="button" class="btn btn-default" data-dismiss="modal">
								关闭
							</button>
						</div>
					</div><!-- /.modal-content -->
				</div><!-- /.modal -->
			</div>
			 <script type="text/javascript">
        function assignFactory(id){
        	
        	$("#productionPatternId").val(id);
        	$('#factory').modal({
    			keyboard: true
    		});
        	
        }
        function saveAssignFactory(){
        	$("#factoryform").ajaxSubmit({  
	            type : "POST",  
	            url: "../productionpattern/saveAssignfactory?id="+$("#productionPatternId").val(),   
	            dataType : "json",  
	            contentType : 'application/x-www-form-urlencoded; charset=UTF-8',  
	            success : function(map) {  
	            	 if(map.head.respCode=="0000000"){
		                	alert("保存成功");
		                	window.location.href="list";
		                }else{
		                	alert(map.body);
		                }
	            },  
	            error : function(map) {  
	                alert("出现错误，请刷新页面");  
	            }  
	  
	        }) 
        
        }
        </script>